# -*- coding: utf-8 -*-
import codecs
import re

def returnMatches(a,b):
	return list(set(a) & set(b))

#filename = "dictfr.txt"
filename = "dict.txt"

#letters = raw_input("Please type 7 letters (Separing by spacing)")
letters = 'a a b i s s e'
letters = letters.split(' ')
letters.sort()

print (letters)

dictFile = open(filename, 'r')

# Create list with file
foo = dictFile.read().split("\n") 

for word in foo:
	lettersWord = list(word)
	lettersWord.sort()
	print returnMatches(lettersWord,letters)




#print letters

